package com.ybxx.core.util;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 功能：上下文辅助类
 * 公司：XA.Co.LTD
 * 制作人：Tom.Y
 * 日期：2011-05*/
public class ContextUtil{
	private static final Log logger = LogFactory.getLog(ContextUtil.class);

//	public static AppUser getCurrentUser(){
//		SecurityContext securityContext = SecurityContextHolder.getContext();
//		if (securityContext != null) {
//			Authentication auth = securityContext.getAuthentication();
//			if (auth != null) {
//				Object principal = auth.getPrincipal();
//				if ((principal instanceof AppUser))
//					return (AppUser)principal;
//			}else {
//				logger.warn("WARN: securityContext cannot be lookuped using SecurityContextHolder.");
//			}
//		}
//		return null;
//	}
//	public static Long getCurrentUserId() {
//		AppUser curUser = getCurrentUser();
//		if (curUser != null) return curUser.getUserId();
//		return null;
//	}
}
